package day8homework;

import java.util.Scanner;

public class Ceshi01 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入数组的长度:");
		int a = scanner.nextInt();
		int[] array = new int[a];
		for(int i = 0; i < array.length ;i++) {
			System.out.println("请输入数组元素");
			int num = scanner.nextInt();
			array[i] = num;
		}
		int max = array[0];
		int min = array[0];
		for(int i =0; i < array.length; i++) {
			if(array[i] > max) {
				max = array[i];
			}
			if(array[i] < min) {
				min = array[i];
			}
		}
		System.out.print("最大值：" + max);
		System.out.println("最小值：" + min);
	}
}
